window.onload = function(){
	var zc_input = document.getElementsByClassName('zc_input')[0]
	var zc_btn = document.getElementsByClassName('zc_btn')[0]
	var passw = document.getElementById("zc_passw")
	var p = /^1(31|32|33|50|36|37|38|39|86|88|70|77|82)\d{8}$/;
	var loginsp1 = document.getElementById("loginsp1")
	zc_input.onblur = function(){
		if(p.test(zc_input.value)){
			loginsp1.innerHTML = ''
			zc_input.style.borderColor = '';
		}
		else{
			loginsp1.innerHTML = '请输入正确的手机格式'
			zc_input.style.borderColor = 'orange';
		}
	}
	zc_btn.onclick = function(){
		if(zc_input.value != '' && passw.value != '' && loginsp1.innerHTML == ''){
		location.href = 'login.html'
		//用户名存入cookie
		var date = new Date();
		date.setDate(date.getDate()+3);
		localStorage["userName"] = zc_input.value;
		localStorage["password"] = passw.value;
		localStorage["isLogin"] = false;
		setCookie("username",zc_input.value,date)
		//密码存入cookie
		setCookie("password",passw.value,date)
		}else{
			alert('请输入正确格式')
		}
	}
}
